<div class="ewForm">

<?php

$JFV=Yii::app()->jformvalidate;
$JFV->setOptions(array(
		'errorElement'=> 'div',
		'errorClass' => 'invalid',
        ));


echo $JFV->form(); 
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo Html::errorSummary($model); ?>

	<div class="row">
		<?php echo Html::activeLabel($model,test1); ?>
		<?php echo $JFV->activeTextField($model,test1); ?>
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,test2); ?>
		<?php echo $JFV->activeTextField($model,test2); ?>
	</div>

	<div class="row">
		<?php echo Html::activeLabel($model,test4); ?>
		<?php echo $JFV->activeTextField($model,test4); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array('class'=>'submit')); ?>
	</div>

<?php echo $JFV->endForm(); ?>

</div><!-- form -->

<script type="text/javascript">
$("form").bind("submit", function() { console.log('submit');return false; });

$.ajaxSetup({
'beforeSend': function(xhr) {xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest")},
});

$('.submit').bind('click', function () {
console.log('clicked');
  jQuery.ajax({
'type':'POST',
'url': jQuery(this).parents("form").attr("action"),
'cache':false,
'beforeSend': function(xhr) {xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest")},
'data':jQuery(this).parents("form").serialize(),
'success':function(html){
jQuery("#content").html(html)}
});
  
  return false;
});

</script>
